package com.study.spring.自定义注解.自定义加载;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.type.filter.AnnotationTypeFilter;

/**
 * [Spring 的类扫描器分析 \- ClassPathBeanDefinitionScanner \- 简书](https://www.jianshu.com/p/d5ffdccc4f5d)
 */
@Configuration
public class 自定义加载 {
    public static void main(String[] args) {
        String basePackage = "com.study.spring.自定义注解.自定义加载";
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        MyScanner scanner = new MyScanner(applicationContext);
        scanner.addIncludeFilter(new AnnotationTypeFilter(MyComponent.class));
        int beanCount = scanner.scan(basePackage);
        System.out.println(beanCount);
    }
}
